<template>
  <view class="container">
    <uni-section title="食物图片" sub-title="" type="square">
      <image :src="'/static/'+data.icon" mode="widthFix"></image>
    </uni-section>
    <uni-section title="食物名称" sub-title="" type="square">
      {{data.name}}
    </uni-section>
    <uni-section title="食物类别" sub-title="" type="square">
      {{data.type}}
    </uni-section>
    <uni-section title="食物价格" sub-title="" type="square">
      ￥{{data.price}}元
    </uni-section>
    <uni-section title="食物介绍" sub-title="" type="square">
      {{data.description}}
    </uni-section>
    <uni-section title="菜品评论" sub-title="" type="square">
      <navigator url="../comment/addcomment" open-type="navigate"><button type="default">发表评论</button></navigator>
      <strong>
        <navigator :url="'../comment/commentlist?foodid='+data.id" open-type="navigate"><button
            type="default">查看评论</button></navigator>
      </strong>
    </uni-section>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        data: {
          "id": 1,
          "name": "烤鸭",
          "type": "肉类",
          "icon": "/images/1.png",
          "description": "烤鸭是北京和南京的一道特色名菜,属于北京菜或金陵菜,该菜品以色泽红艳,肉质细嫩,味道醇厚,肥而不腻的特色,被誉为“天下美味”而驰名中外,其色泽略黄,柔软淡香,夹卷其他荤素食物食用,为宴席常用菜点,更是家常风味美食。",
          "price": 88.5
        }
      }
    },
    methods: {

    },
    onLoad(e) {
      let id = e.id
      uni.request({
        url: this.$baseUrl+'food/findone',
        method: 'POST',
        data: {
          id: id
        },
        success: res => {
          this.data = res.data.data
        },
        fail: () => {},
        complete: () => {}
      });
    }
  }
</script>

<style>
  .container {
    padding: 10px;
    font-size: 14px;
    line-height: 24px;
  }
</style>